<template>
  <view>
    <scroll-view class="scroll">
      <view class="list" v-for="item in userinfolist" :key="item.id" @click="goherhome(item.user_id)">
        <view style="display: flex">
          <image class="avatar" :src="item.user.avatar" mode="aspectFill"></image>
          <view class="text">
            <view style="display: flex">
              <text style="font-size: 28rpx">{{ item.user.nickname }}</text>
              <image :src="`../static/icon/${item.user.gender == 0 ? 'gendernv.png' : 'gendernan.png'}`" mode="" style="width: 40rpx; height: 40rpx"></image>
              <text style="font-size: 24rpx">{{ item.user.age }}</text>
            </view>
            <view class="time">{{ item.user.jointime_text }}</view>
          </view>
        </view>
        <view class="right"></view>
      </view>
    </scroll-view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      userinfolist: []
    };
  },
  onLoad(value) {
    // 获取活动id
    this.getsignuplist(value.id);
    console.log(value.id);
  },
  methods: {
    // 获取报名列表
    async getsignuplist(id) {
      const res = await uni.$http.post('index/getActivityUserList', {
        activity_id: Number(id),
        token: JSON.parse(uni.getStorageSync('userinfo')).token
      });

      this.userinfolist = res.data.data;
    },
    // 跳转他人主页
    goherhome(id) {
      uni.navigateTo({
        url: '/sub_active/otherhome/otherhome?id=' + id
      });
    }
  }
};
</script>

<style>
.scroll {
  height: 100%;
}
.list {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 40rpx;
  width: 100%;
  height: 100rpx;
  border-bottom: 1rpx dotted #ccc;
}
.avatar {
  width: 100rpx;
  height: 100rpx;
  border-radius: 50%;
}
.right {
  width: 16rpx;
  height: 16rpx;
  font-weight: 800;
  margin-right: 80rpx;
  border-right: 1rpx solid black;
  border-bottom: 1rpx solid black;
  transform: rotate(-45deg);
}
.text {
  margin-left: 30rpx;
}
.time {
  margin-top: 20rpx;
  font-size: 24rpx;
}
</style>
